﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<link href="__STATIC__/admin/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<body>

<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 门店管理 <span class="c-gray en">&gt;</span> 添加门店
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>

<div class="page-container">

	<div action="" method="post" class="form form-horizontal" id="form-shops-add" enctype="multipart/form-data">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>门店名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$store_info.store_name}" placeholder="" id="store_name" style="width:60%;">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>门店编号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$store_info.store_no}" placeholder="" id="store_no" style="width:60%;" disabled="disabled">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>联系电话：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$store_info.store_tel}" placeholder="" id="store_tel" style="width:60%;">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>详细地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$store_info.store_address}" placeholder="" id="store_address" style="width:60%;">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">备注信息：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="abstract" cols="" rows="" class="textarea"  placeholder="备注门店信息" id="remark" style="width:60%;">{$store_info.remark}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input type="hidden" id="store_id" value="{$store_info.store_id}">
				<button class="btn btn-primary radius" type="submit" id="submit">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <a class="btn btn-warning radius" href="{:url('index')}">&nbsp;&nbsp;取消&nbsp;&nbsp;</a>
			</div>
		</div>
	</div>

</div>
{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){

        $("#submit").click(function(){

            var store_id 		= $("#store_id").val();
            var store_name 		= $("#store_name").val();
			var store_no 		= $("#store_no").val();
			var store_tel 		= $("#store_tel").val();
			var store_address 	= $("#store_address").val();
			var remark 			= $("#remark").val();

			// 门店名称
			if(store_name == ''){
                layer.msg('门店名称不可为空!',{icon:7,time:1000});
                $("#store_name").focus();
                return ;
			}

            // 门店编号
            if(store_no == ''){
                layer.msg('门店编号不可为空!',{icon:7,time:1000});
                $("#store_no").focus();
                return ;
            }

            // 门店联系方式
            if(store_tel == ''){
                layer.msg('请填写联系电话!',{icon:7,time:1000});
                $("#store_tel").focus();
                return ;
            }

            // 门店地址
            if(store_address == ''){
                layer.msg('地址不可为空!',{icon:7,time:1000});
                $("#store_address").focus();
                return ;
            }

            // 异步提交数据
			$.post(
			    "{:url('edit')}",
				{
				    store_id:store_id,
				    store_name:store_name,
					store_no:store_no,
					store_tel:store_tel,
					store_address:store_address,
					remark:remark
				},
				function (res) {

					if(res.code === 0){

                        layer.msg(res.msg,{icon:5,time:2000});

					}else{

                        layer.msg(res.msg,{icon:6,time:2000});

                        // 定时跳转页面
                        setTimeout(
                            // 跳转至管理后台首页
                            function(){
                                location.replace("{:url('index')}");
                            },
                            3000
                        );
					}
                }
			);

		});

    });
</script>

</body>
</html>